home *** CD-ROM | disk | FTP | other *** search
/ New Masters of Flash / New Masters of Flash.iso / pc / MOVIES / 16.dir / 00280_Text_text17.txt < prev    next >
Text File  |  2000-10-01  |  3KB  |  27 lines

  1. So now our Flash file is getting pretty nice. The bottom layer should be the checkered board pattern. The layer on top of that should be the WireFrame Buttons layer. Then on top of that should be the A Queens layer, with all the queens in that layer having instance names of A1, A2, A3, etc. Above the should be the B Queens, then the C Queens and so on till the H Queens layer. The stage should look like a chess board with every space filled with a queen. Pretty cool, huh?
  2. Now for the hard part: the ActionScript. Just kidding, itΓÇÖs not hard. Although, IΓÇÖd like to say that I had help from my programmer friend Ollie von Gerbig. We were hanging out one night talking shop and I showed him what I had so far with the Queens Of Death. We started talking about the math of chess and similar things, and he really devised the logic of the ActionScript weΓÇÖre about to go over. ItΓÇÖs really amazing what he could program considering how drunk we were. I recommend not being drunk while coding ActionScript. I would also like to say that some of my variable names might get a bit, well, odd. This is just a leftover from the trial-and-error process I went through when I was writing this thing - sorry about that.
  3. Right-click on the WireFrame Buttons layer, and lock or hide others. Double-click the wireframe button at H1, and put in this action script:
  4.  
  5. On (release) {
  6.    tellTarget (ΓÇ£/H1ΓÇ¥) {
  7.     play ();
  8.    }
  9.    gotoandPlay (ΓÇ£waitΓÇ¥);
  10.    queenname1 = ΓÇ£H1ΓÇ¥;
  11. }
  12.  
  13. This is whatΓÇÖs going on here. First we tellTarget /H1, which is the queen movie for this square, to play. If you remember, the movie stops at both the down and the up state. This will reverse that. So if itΓÇÖs down, the queen will go up. If the queen is up, it will go down.
  14. The next command, Go to and Play (ΓÇ£WaitΓÇ¥), weΓÇÖll get to in a minute, but needless to say this is where the movie will check to see if there are other queens in the way. And by setting the variable queenname1 to H1, our code will know which queen is the new one and not to remove it. (Because we want the queen that was just placed to stay and any queens that are being attacked to disappear.)
  15.  
  16. Unfortunately for you, you need to do this to the other 63 wire frame buttons. So, double click the H2 button and put this action script in there:
  17.  
  18. on (release) {
  19.    tell Target (ΓÇ£/H2ΓÇ¥){
  20.     play ();
  21.    }
  22.       gotoandPlay (ΓÇ£waitΓÇ¥);
  23.       queenname1 = ΓÇ£H2ΓÇ¥;
  24. }
  25. Note that you can probably just copy this code and paste it into the buttons only change the two H2ΓÇÖs to what ever block youΓÇÖre on. Just make sure you do this for all the buttons.
  26.  
  27.